package com.ichina.chat.dao;

import java.util.Date;

import com.ichina.chat.vo.UserInfo;

public interface UserInfoDao 
{
	/**
	 * 增加一行信息
	 * @param u
	 * @throws Exception
	 */
	public void addUserInfo(UserInfo u) throws Exception;
	
	/**
	 * 根据IP删除
	 * @param ip
	 * @return
	 * @throws Exception
	 */
	public boolean deleteUserByIp(String ip) throws Exception;
	
	/**
	 * 根据ID更新
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public boolean updateUer(int id) throws  Exception;
	
	/**
	 * 根据IP更新
	 * @param u
	 * @return
	 * @throws Exception
	 */
	public boolean updateUser(UserInfo u) throws Exception;
	
	/**
	 * 根据某IP查询是否来过
	 * @param ip
	 * @return
	 * @throws Exception
	 */
	public int queryUserByIp(String ip) throws Exception;
	
	/**
	 * 根据今天时间查询
	 * @param time
	 * @return
	 * @throws Exception
	 */
	public int queryUserByToday(Date time) throws Exception;
	
	/**
	 * 根据今天日期查询昨天访问数
	 * @param time
	 * @return
	 * @throws Exception
	 */
	public int queryUserByYesterday(Date time) throws Exception;
	
	/**
	 * 根据今天日期查询上星期访问数
	 * @param time
	 * @return
	 * @throws Exception
	 */
	public int queryUserByLastWeek(Date time) throws Exception;
	
	/**
	 * 根据今天日期查询上个月访问数
	 * @param time
	 * @return
	 * @throws Exception
	 */
	public int queryUsrByLastMonth(Date time) throws Exception;
	
	/**
	 * 查询总访问数
	 * @return
	 * @throws Exception
	 */
	public int queryUserTotal() throws Exception;
	
	/**
	 * 根据IP查询URL
	 * @param ip
	 * @return
	 * @throws Exception
	 */
	public String queryUserUrl(String ip) throws Exception;
	
	/**
	 * 根据IP查询时间
	 * @param ip
	 * @return
	 * @throws Exception
	 */
	public boolean queryIpTime(String ip) throws Exception;
	
	/**
	 * 根据某IP查询访问次数
	 * @param ip
	 * @return
	 * @throws Exception
	 */
	public int queryIpCountByIp(String ip) throws Exception;
}
